package com.bi.bitest.bao.entity.discoverrecommend;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.LinkedList;
import java.util.List;

public class DiscoverRecommendAlbums extends DiscoverRecommendItem {

	/**
	 * "title": "小编推荐",
	 "hasMore": true,
	 "list":[]
	 */
	private int ret;
	//推荐的专辑
	private List<AlbumRecommend> albumRecommends;
	public void parseJSON(JSONObject json) throws JSONException {
		//因为super中包含了title hasmore
		super.parseJSON(json);
		ret=json.optInt("ret", 0);
		JSONArray array=json.getJSONArray("list");
		int len=array.length();
		albumRecommends=new LinkedList<AlbumRecommend>();
		if(len>0){
			for(int i=0;i<len;i++){
				JSONObject obj=array.getJSONObject(i);
				AlbumRecommend albumRecommend=new AlbumRecommend();
				albumRecommend.parseJSON(obj);
				albumRecommends.add(albumRecommend);
			}
		}

	}

	public List<AlbumRecommend> getAlbumRecommends() {
		return albumRecommends;
	}
}